package com.cssy.xxkj.logic.dao.impl;

import com.cssy.xxkj.logic.dao.LogicReceptReturnDAO;
import com.cssy.xxkj.logic.entity.LogicReceptReturnDO;
import com.plat.helper.SearchConditions;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * 数据访问对象实现类
 * @since 2014-10-10
 */
public class LogicReceptReturnDAOImpl extends SqlMapClientDaoSupport implements LogicReceptReturnDAO {

    /**
     * 插入数据
     * @param logicReceptReturnDO
     * @return 插入数据的主键
     */
    public String insertLogicReceptReturnDO(LogicReceptReturnDO logicReceptReturnDO) {
        Object id = getSqlMapClientTemplate().insert("LogicReceptReturn.insert", logicReceptReturnDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicReceptReturnDO
     * @return 查出的记录数
     */
    public Integer countLogicReceptReturnDOByExample(LogicReceptReturnDO logicReceptReturnDO) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicReceptReturn.countByDOExample", logicReceptReturnDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicReceptReturnDO
     * @return 受影响的行数
     */
    public Integer updateLogicReceptReturnDO(LogicReceptReturnDO logicReceptReturnDO) {
        int result = getSqlMapClientTemplate().update("LogicReceptReturn.update", logicReceptReturnDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicReceptReturnDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicReceptReturnDO> findListByExample(LogicReceptReturnDO logicReceptReturnDO) {
        List<LogicReceptReturnDO> list = getSqlMapClientTemplate().queryForList("LogicReceptReturn.findListByDO", logicReceptReturnDO);
        return list;
    }

    /**
     * 根据主键获取logicReceptReturnDO
     * @param id
     * @return logicReceptReturnDO
     */
    public LogicReceptReturnDO findLogicReceptReturnDOByPrimaryKey(String id) {
        LogicReceptReturnDO logicReceptReturnDO = (LogicReceptReturnDO) getSqlMapClientTemplate().queryForObject("LogicReceptReturn.findByPrimaryKey", id);
        return logicReceptReturnDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicReceptReturnDOByPrimaryKey(String id) {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicReceptReturn.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicReceptReturnDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicReceptReturnDO> list = getSqlMapClientTemplate().queryForList("LogicReceptReturn_ex.find", scs);
		return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer row = (Integer)getSqlMapClientTemplate().queryForObject("LogicReceptReturn_ex.count", scs);
		return row;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		Integer row = (Integer)getSqlMapClientTemplate().queryForObject("LogicReceptReturn_ex.deleteBizRemoved", id);
		return row;
	}

}